import { createRouter, createWebHashHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
// import homeView from '../views/home/index.vue'

const routes = [
  {
    path: '/',
    name: 'home',
    redirect: '/home',
    component: HomeView
  },
  {
    path: '/home',
    name: 'homeView',
    meta: {
      isTabShow: true
    },
    component: () => import('../views/home/index.vue')
  },
  {
    path: '/home/news',
    name: 'newsView',
    component: () => import('../views/home/news/index.vue')
  },
  {
    path: '/home/search',
    name: 'searchView',
    component: () => import('../views/home/search/index.vue')
  },
  {
    path: '/home/location',
    name: 'locationView',
    component: () => import('../views/home/location/index.vue')
  },
  {
    path: '/home/brand',
    name: 'brandView',
    component: () => import('../views/home/brand/index.vue')
  },
  {
    path: '/topic',
    name: 'topicView',
    meta: { isTabShow: true },
    component: () => import('../views/topic/index.vue')
  },
  {
    path: '/topic/topicDetail',
    name: 'topicDetail',
    component: () => import('../views/topic/topicDetail/index.vue')
  },
  {
    path: '/cagetory',
    name: 'cagetoryView',
    meta: { isTabShow: true },
    component: () => import('../views/cagetory/index.vue')
  },
  {
    path: '/cagetory/list',
    name: 'cageList',
    component: () => import('../views/cagetory/list/index.vue')
  },
  {
    path: '/cagetory/list/info',
    name: 'cageListInfo',
    component: () => import('../views/cagetory/list/info/index.vue')
  },
  {
    path: '/cart',
    name: 'cartView',
    meta: { isTabShow: true },
    component: () => import('../views/cart/index.vue')
  },
  {
    path: '/cart/order',
    name: 'orderView',
    component: () => import('../views/cart/order/index.vue')
  },
  {
    path: '/mine',
    name: 'mineView',
    meta: { isTabShow: true },
    component: () => import('../views/mine/index.vue')
  },
  {
    path: '/mine/address',
    name: 'addressView',
    component: () => import('../views/mine/address/index.vue')
  },
  {
    path: '/mine/collect',
    name: 'collectView',
    component: () => import('../views/mine/collect/index.vue')
  },
  {
    path: '/mine/address/edit',
    name: 'editView',
    component: () => import('../views/mine/address/edit/index.vue')
  },
  {
    path: '/about',
    name: 'about',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
